package com.maimao.model.goods;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author MaoLin Wang
 * @date 2020/11/27 10:43 下午
 */
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@TableName("mm_brand")
public class Brand implements Serializable {

    private static final long serialVersionUID = -3221464000982424258L;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableId(type = IdType.AUTO)
    private Long id;

    @NotBlank(message = "品牌名不能为空")
    private String name;

    @TableField(value = "`desc`")
    private String desc;

    private String logo;

    @TableField(value = "shop_url")
    private String shopUrl;

    @TableField(value = "`order`")
    private Integer order;

    private Integer hot;

    private Integer recommend;

    @TableField(value = "`create_time`")
    private LocalDateTime createTime;

    /**
     * 所属用户或企业id
     */
    @NotNull(message = "品牌主不能为空")
    @TableField(value = "`owner_id`")
    private Long ownerId;

    /**
     * 店铺ID 因为ownerId不能确定是普通用户还是企业用户
     */
    @TableField(value = "shop_id")
    @NotNull(message = "店铺ID不能为空")
    private Long shopId;

    private String pinyin;

    /**
     * 拼音首字母
     */
    private String head;

    @TableField(value = "`status`")
    private Integer status;

    @TableField(value = "fail_reason")
    private String failReason;

    @Override
    public String toString() {
        return "Brand{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                ", logo='" + logo + '\'' +
                ", shopUrl='" + shopUrl + '\'' +
                ", order=" + order +
                ", hot=" + hot +
                ", recommend=" + recommend +
                ", createTime=" + createTime +
                ", ownerId=" + ownerId +
                ", pinyin='" + pinyin + '\'' +
                ", head='" + head + '\'' +
                ", status='" + status + '\'' +
                '}';
    }
}
